package com.dkd.easybook.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkd.common.annotation.Log;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.common.enums.BusinessType;
import com.dkd.easybook.domain.EbReminders;
import com.dkd.easybook.service.IEbRemindersService;
import com.dkd.common.utils.poi.ExcelUtil;
import com.dkd.common.core.page.TableDataInfo;

/**
 * 提醒列表Controller
 *
 * @author itheima
 * @date 2024-12-13
 */
@Api(tags = "提醒列表Controller")
@RestController
@RequestMapping("/easybook/remindersList")
public class EbRemindersController extends BaseController
{
    @Autowired
    private IEbRemindersService ebRemindersService;

    /**
     * 查询提醒列表列表
     */
    @ApiOperation("查询提醒列表列表")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:list')")
    @GetMapping("/list")
    public TableDataInfo list(EbReminders ebReminders)
    {
        startPage();
        List<EbReminders> list = ebRemindersService.selectEbRemindersList(ebReminders);
        return getDataTable(list);
    }

    /**
     * 导出提醒列表列表
     */
    @ApiOperation("导出提醒列表列表")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:export')")
    @Log(title = "提醒列表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EbReminders ebReminders)
    {
        List<EbReminders> list = ebRemindersService.selectEbRemindersList(ebReminders);
        ExcelUtil<EbReminders> util = new ExcelUtil<EbReminders>(EbReminders.class);
        util.exportExcel(response, list, "提醒列表数据");
    }

    /**
     * 获取提醒列表详细信息
     */
    @ApiOperation("获取提醒列表详细信息")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:query')")
    @GetMapping(value = "/{reminderId}")
    public AjaxResult getInfo(@PathVariable("reminderId") Long reminderId)
    {
        return success(ebRemindersService.selectEbRemindersByReminderId(reminderId));
    }

    /**
     * 新增提醒列表
     */
    @ApiOperation("新增提醒列表")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:add')")
    @Log(title = "提醒列表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EbReminders ebReminders)
    {
        return toAjax(ebRemindersService.insertEbReminders(ebReminders));
    }

    /**
     * 修改提醒列表
     */
    @ApiOperation("修改提醒列表")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:edit')")
    @Log(title = "提醒列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EbReminders ebReminders)
    {
        return toAjax(ebRemindersService.updateEbReminders(ebReminders));
    }

    /**
     * 删除提醒列表
     */
    @ApiOperation("删除改提醒列表")
    @PreAuthorize("@ss.hasPermi('easybook:remindersList:remove')")
    @Log(title = "提醒列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reminderIds}")
    public AjaxResult remove(@PathVariable Long[] reminderIds)
    {
        return toAjax(ebRemindersService.deleteEbRemindersByReminderIds(reminderIds));
    }
}
